Skip to content

Add configuration option to turn off skeleton pack generation#2359

Merged
elenatanasoiu merged 21 commits intomainfrom
yer-a-ternary-choice-query
May 4, 2023
Merged

Add configuration option to turn off skeleton pack generation#2359
elenatanasoiu merged 21 commits intomainfrom
yer-a-ternary-choice-query

Conversation

@elenatanasoiu
Copy link
Copy Markdown
Contributor

@elenatanasoiu elenatanasoiu commented Apr 19, 2023

We'd like to make auto generation of QL packs the default behaviour in the extension.

We have two flows at the moment that only work in the codespaces-codeql template:

  1. the skeleton wizard flow which triggers when you run the CodeQL: Create query command
  2. the database panel flow which offers to create a QL pack for you when you download a database from GitHub (see prompt below)
Screenshot 2023-04-19 at 18 25 02

For the second flow, we should offer the user a third option called "No, and never ask me again".

Screenshot 2023-04-19 at 18 54 15

This will disable auto generation. We are writing this choice to a VS Code setting called codeQL.createQuery.autogenerateQlPacks and checking for it before deciding whether to prompt the user again.

Screen.Recording.2023-04-19.at.18.51.47.mov

@elenatanasoiu elenatanasoiu requested a review from a team as a code owner April 19, 2023 16:54
@elenatanasoiu elenatanasoiu requested a review from a team April 19, 2023 16:57
@elenatanasoiu elenatanasoiu force-pushed the yer-a-ternary-choice-query branch 2 times, most recently from 9e6fe9c to e99f5ef Compare April 19, 2023 17:07
@elenatanasoiu elenatanasoiu changed the title Add CodeQL extension configuration option to turn off skeleton pack generation Add configuration option to turn off skeleton pack generation Apr 19, 2023
Copy link
Copy Markdown
Contributor

@shati-patel shati-patel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall, thanks! 🍫 🥐

I've just left some questions inline about the "format" of the config option ⚙

Comment thread extensions/ql-vscode/package.json Outdated
Comment thread extensions/ql-vscode/package.json Outdated
Comment thread extensions/ql-vscode/test/vscode-tests/no-workspace/helpers.test.ts Outdated
Comment thread extensions/ql-vscode/test/vscode-tests/no-workspace/helpers.test.ts
Comment thread extensions/ql-vscode/package.json Outdated
Comment thread extensions/ql-vscode/src/config.ts Outdated
@robertbrignull
Copy link
Copy Markdown
Contributor

I really like that we're making this configurable. I'm sorry for being nit-picky about the definition of it, but since this is going to become user configuration, we want to be extra sure about it because we want to avoid changing it in the future.

@elenatanasoiu
Copy link
Copy Markdown
Contributor Author

I'm sorry for being nit-picky about the definition of it

No need to apologise @robertbrignull! I enjoy getting feedback from you 👍

In the next commit we will write to this setting when the user chooses
to disable the QL pack generation and prefers to never be asked again
about it.
By writing the setting to our new `codeQL.autogenerateQlPacks` setting.
We modify both these options in the beforeEach(). We should reset
them in the afterEach().
To make it clear what it's supposed to be storing.
I initially started defining an enum, but I'm not able to import it in package.json,
where the list of options is defined (under `codeQL.createQuery.autogenerateQlPacks`).
@elenatanasoiu elenatanasoiu force-pushed the yer-a-ternary-choice-query branch from 0d684e8 to d242117 Compare April 27, 2023 12:35
@elenatanasoiu
Copy link
Copy Markdown
Contributor Author

Thanks for the great explanations @shati-patel & @robertbrignull! 🙇‍♀️

I've had to rebase to account for file changes in the extension.

Bar any CI woes, this is ready for a re-review.

Copy link
Copy Markdown
Contributor

@shati-patel shati-patel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the updates! ✨ A few more places to change, using the new enum 😎

Comment thread extensions/ql-vscode/src/databases/local-databases.ts Outdated
Comment thread extensions/ql-vscode/src/databases/local-databases.ts Outdated
Comment thread extensions/ql-vscode/test/vscode-tests/minimal-workspace/local-databases.test.ts Outdated
@elenatanasoiu elenatanasoiu force-pushed the yer-a-ternary-choice-query branch from c2a0b62 to f10185a Compare April 27, 2023 15:42
@elenatanasoiu
Copy link
Copy Markdown
Contributor Author

Thanks @shati-patel ❤️ I think it should be correct now.

@shati-patel
Copy link
Copy Markdown
Contributor

Thanks @shati-patel ❤️ I think it should be correct now.

Nice! Looks good to me.

@robertbrignull, can I punt over to you for a final review/approval? (Since you suggested the new structure 🎈)

Copy link
Copy Markdown
Contributor

@robertbrignull robertbrignull left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've had another look through and on the second look I've spotted a few things that could use some more attention. I think this PR is definitely heading in the right direction, but we risk making more bugs for ourselves and a confusing interface for users if we try to go too fast.

Comment thread extensions/ql-vscode/package.json Outdated
Comment thread extensions/ql-vscode/src/config.ts Outdated
Comment thread extensions/ql-vscode/src/config.ts Outdated
Comment thread extensions/ql-vscode/src/config.ts Outdated
Comment thread extensions/ql-vscode/src/config.ts Outdated
Comment thread extensions/ql-vscode/src/databases/local-databases.ts
Comment thread extensions/ql-vscode/package.json Outdated
Comment thread extensions/ql-vscode/test/vscode-tests/minimal-workspace/local-databases.test.ts Outdated
@elenatanasoiu elenatanasoiu force-pushed the yer-a-ternary-choice-query branch 3 times, most recently from 53d313e to 8220541 Compare May 3, 2023 09:12
And update descriptions for them.
@elenatanasoiu elenatanasoiu force-pushed the yer-a-ternary-choice-query branch from 8220541 to 9ecb503 Compare May 3, 2023 12:14
Copy link
Copy Markdown
Contributor

@robertbrignull robertbrignull left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One comment that needs updating after we changed the definition of things, but otherwise LGTM from just looking at the code.

I have tried to test this and I can't get the code to trigger, but I think it's because I'm not used to working with the codespace. Have you tested this, especially since we made a lot of modifications in review?

Comment thread extensions/ql-vscode/src/config.ts Outdated
@elenatanasoiu elenatanasoiu force-pushed the yer-a-ternary-choice-query branch from ffd3e76 to a85d9d1 Compare May 3, 2023 15:07
@elenatanasoiu
Copy link
Copy Markdown
Contributor Author

elenatanasoiu commented May 3, 2023

Have you tested this, especially since we made a lot of modifications in review?

Yes, you have to uncomment "${workspaceRoot}/../codespaces-codeql/tutorial.code-workspace" from launch.json and make sure you've run npm run build.

I've just tested this and the setting was written correctly. I also tested that we stop asking if the setting is set to "never". I can follow up with a recording.

Thanks for the thorough review!

@elenatanasoiu
Copy link
Copy Markdown
Contributor Author

@elenatanasoiu elenatanasoiu enabled auto-merge May 4, 2023 07:34
@elenatanasoiu elenatanasoiu merged commit 3a5a81a into main May 4, 2023
@elenatanasoiu elenatanasoiu deleted the yer-a-ternary-choice-query branch May 4, 2023 07:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants